<?php

namespace addons\xpframework\library\xcore\xcore;

use think\Exception;

class XcException extends Exception
{
    protected $customMessage;

    public function __construct($message, $code = 0, Exception $previous = null, $debugMessage = null)
    {
        XcDebugUtils::logger($debugMessage);
        parent::__construct($message, $code, $previous);
        $this->customMessage = $message;
    }

    public function getCustomMessage()
    {
        return $this->customMessage;
    }

    public function __toString()
    {
        return __CLASS__ . ": [{$this->code}]: {$this->customMessage}\n";
    }
}
